package voiture;

import serveurPoste.Dossier;



public class BanqueReactions {
	
	private CollectionReactions reactions;
	private int currentid = 0;
	
	public BanqueReactions(){
		reactions = new CollectionReactions();
	}
	
	public Reaction trouverReactionParId(int idReaction){
		Reaction r = new Reaction(0,"",0);
		
		
		if(reactions.getListeReaction().size()>=idReaction){
			r = reactions.getListeReaction().get(idReaction);
		}
		

		return r; 
		
	}
	
	public CollectionReactions trouverReactionsParDossier(Dossier mydossier)
	{
		CollectionReactions reactionsRetour = new CollectionReactions();
		
		int i=0;
		while( mydossier.getListeReaction()[i]> 0){
			reactionsRetour.getListeReaction().add(reactions.getListeReaction().get(mydossier.getListeReaction()[i])) ;
		}		
		
		return reactionsRetour;
		
	}
	
	public void ajouterReaction(String reaction, int gravite)
	{
		Reaction thereaction = new Reaction(currentid++, reaction, gravite);
		reactions.getListeReaction().add(thereaction);
	}
	
	public int getReactionsSize(){
		return reactions.size();
	}
	
	public CollectionReactions getReactionsList(){
		return reactions;
	}
	
}
